package org.sdv.servlet.container;

import java.util.Set;

import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;

import org.sdv.servlet.AddCalculationServlet;

public class CustomServletContainerInitializer implements ServletContainerInitializer {

	public void onStartup(Set<Class<?>> classes, ServletContext ctx)
			throws ServletException {
		System.out.println("*** CustomServletContainerInitializer ***");
		
		ServletRegistration.Dynamic registration = ctx.addServlet("AddCalculation", AddCalculationServlet.class);
		
		registration.addMapping("/calculator/add");		
		registration.addMapping("/calc-add");
		
		registration.setInitParameter("arg1", "2");
		registration.setInitParameter("arg2", "3");
	}
}
